home *** CD-ROM | disk | FTP | other *** search
/ Power Bytes: Money & Finance / PowerBytes Money and Finance CD-ROM 01 / PowerBytes Money and Finance CD-ROM 01.iso / Demos / TrueBASIC Demo / Libraries / FnhLib < prev    next >
Encoding:
Text File  |  1985-05-31  |  1.3 KB  |  69 lines  |  [TEXT/TRUE]

  1. !  Library of hyperbolic functions
  2. !  Copyright (c) 1985 by True BASIC, Inc.
  3.  
  4. EXTERNAL
  5.  
  6. DEF sinh(x) = (exp(x)-exp(-x))/2
  7.  
  8. DEF cosh(x) = (exp(x)+exp(-x))/2
  9.  
  10. DEF tanh(x)
  11.     DECLARE DEF sinh, cosh
  12.     LET tanh = sinh(x)/cosh(x)
  13. END DEF
  14.  
  15. DEF coth(x)
  16.     DECLARE DEF sinh, cosh
  17.     LET coth = cosh(x)/sinh(x)
  18. END DEF
  19.  
  20. DEF sech(x)
  21.     DECLARE DEF cosh
  22.     LET sech = 1/cosh(x)
  23. END DEF
  24.  
  25. DEF csch(x)
  26.     DECLARE DEF sinh
  27.     IF x=0 then CAUSE EXCEPTION -3000, "Argument not in range"
  28.     LET csch = 1/sinh(x)
  29. END DEF
  30.  
  31. DEF asinh(x) = log(x + sqr(x*x+1))
  32.  
  33. DEF acosh(x)
  34.     IF abs(x)<1 then
  35.        CAUSE EXCEPTION -3000, "Argument not in range"
  36.     ELSE
  37.        LET acosh = log(x + sqr(x*x-1))
  38.     END IF
  39. END DEF
  40.  
  41. DEF atanh(x)
  42.     IF abs(x)>=1 then
  43.        CAUSE EXCEPTION -3000, "Argument not in range"
  44.     ELSE
  45.        LET atanh = log((1+x)/(1-x))/2
  46.     END IF
  47. END DEF
  48.  
  49. DEF acoth(x)
  50.     IF abs(x)<=1 then
  51.        CAUSE EXCEPTION -3000, "Argument not in range"
  52.     ELSE
  53.        LET acoth = log((1+x)/(x-1))/2
  54.     END IF
  55. END DEF
  56.  
  57. DEF asech(x)
  58.     IF abs(x)>1 then
  59.        CAUSE EXCEPTION -3000, "Argument not in range"
  60.     ELSE
  61.        LET asech = log((1+sqr(1-x*x))/x)
  62.     END IF
  63. END DEF
  64.  
  65. DEF acsch(x)
  66.     IF x=0 then CAUSE EXCEPTION -3000, "Argument not in range"
  67.     LET acsch = log((1+sgn(x)*sqr(x*x+1))/x)
  68. END DEF
  69.